package edu.scau.core.Enum;

import org.apache.ibatis.type.EnumTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.TypeHandler;

import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public enum ColorEnum {

    cream("奶油色"),

    GREEN("绿色"),
    pink("粉色"),

    BLUE("蓝色"),

    YELLOW("黄色"),

    BLACK("黑色"),

    WHITE("白色"),
    deepblue("深蓝色"),

    GRAY("灰色");


    private final String color;

    ColorEnum(String color) {
        this.color = color;
    }

    public String getColor() {
        return color;
    }

    public static ColorEnum fromString(String color) {
        for (ColorEnum c : ColorEnum.values()) {
            if (c.color.equalsIgnoreCase(color)) {
                return c;
            }
        }
        throw  new IllegalArgumentException("不存在该颜色选项");
    }
}